<?php

declare(strict_types=1);

namespace App\Controller;

use App\Model\Contract;
use App\Model\ContractClass;
use App\Model\Member;
use App\Model\Special;
use Hyperf\Redis\Redis;
use Hyperf\ViewEngine\Contract\FactoryInterface;
use Hyperf\ViewEngine\Contract\ViewInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use App\Model\Normal;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use function Hyperf\ViewEngine\view;
use Trait\ResponseMsg;

/**
 * 支付
 */
class PayController extends AbstractController
{
    use ResponseMsg;

    protected Redis $redis;
    protected Normal $normal;
    protected Contract $contract;
    protected ContractClass $contractClass;
    protected Member $member;
    protected Special $special;

    public function __construct()
    {
        $this->redis = container()->get(Redis::class);
        $this->normal = container()->get(Normal::class);
        $this->contract = container()->get(Contract::class);
        $this->contractClass = container()->get(ContractClass::class);
        $this->member = container()->get(Member::class);
        $this->special = container()->get(Special::class);
    }

    /**
     * 支付页面
     * @return FactoryInterface|ResponseInterface|ViewInterface
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function  pay(): FactoryInterface|ResponseInterface|ViewInterface
    {
        $class_list = ContractClass::homeClass();//获取全部分类
        return view('pay', [
            'class_list' => $class_list,
        ]);
    }
}

